package demo.demo05;

public class FingerGuessGame {
    public static void main(String[] args) {
        FingerGuess player1 = new FingerGuess("小羊");
        FingerGuess player2 = new FingerGuess("小鹿");
        //玩家1出拳
        player1.showFinger();
        player1.show();
        //玩家2出拳
        player2.showFinger();
        player2.show();
        //判断输赢
        judge(player1, player2);
    }
    public static void judge(FingerGuess player1, FingerGuess player2) {
        if (player1.finger == player2.finger) {
            System.out.println("平局");
            return;
        }
        if(player1.finger == 0 && player2.finger == 2 || 
            player1.finger == 1 && player2.finger == 0 ||
            player1.finger == 2 && player2.finger == 1){
                System.out.println(player1.name + "赢了");
        }else{
            System.out.println(player2.name + "赢了");
        }
    }
}
